<script setup lang="ts">
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import DefaultLayout from '@/layouts/DefaultLayout.vue';
import AuthLayout from '@/layouts/AuthLayout.vue';
import EmptyLayout from '@/layouts/EmptyLayout.vue';

const route = useRoute();

// 动态选择布局
const layout = computed(() => {
  const layoutName = route.meta.layout || 'DefaultLayout';
  switch (layoutName) {
    case 'AuthLayout':
      return AuthLayout;
    case 'EmptyLayout':
      return EmptyLayout;
    default:
      return DefaultLayout;
  }
});
</script>

<template>
  <component :is="layout">
    <router-view />
  </component>
</template>
